package com.luyuan.wxapp.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.luyuan.common.annotation.Log;
import com.luyuan.common.core.domain.AjaxResult;
import com.luyuan.common.enums.BusinessType;
import com.luyuan.gallery.domain.ExhiLikes;
import com.luyuan.gallery.service.IExhiLikesService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 点赞记录Controller
 * 
 * @author luyuan
 * @date 2025-11-19
 */
@Api(value = "微信小程序展览接口", tags = "wx_like")
@RestController
@RequestMapping("/wxapp/likes")
public class WxappExhiLikesController extends WxBaseController {
    @Autowired
    private IExhiLikesService exhiLikesService;

    /**
     * 新增点赞记录
     */
    @ApiOperation(value = "新增点赞记录", notes = "新增点赞记录", nickname = "addLike")
    @Log(title = "点赞记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ExhiLikes exhiLikes) {
        return toAjax(exhiLikesService.insertExhiLikes(exhiLikes));
    }

    /**
     * 修改点赞记录
     */
    @ApiOperation(value = "修改点赞记录", notes = "修改点赞记录", nickname = "editLike")
    @Log(title = "点赞记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ExhiLikes exhiLikes) {
        return toAjax(exhiLikesService.updateExhiLikes(exhiLikes));
    }

    /**
     * 删除点赞记录
     */
    @ApiOperation(value = "删除点赞记录", notes = "删除点赞记录", nickname = "removeLike")
    @Log(title = "点赞记录", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(exhiLikesService.deleteExhiLikesByIds(ids));
    }
}
